from plugin.db import Influx
from plugin.logger import MyLogger, get_log, LOGFORMAT
from plugin.db import DB, MSsqlClient, MysqlClient, RedisClient, Sqlite, SqliteIndep
from plugin.exception import MyException
from config import baseconfig, projectconfig, apidocconfig, pluginconfig
from plugin.scheduler import Trigger
if pluginconfig.scheduler:
    from plugin.scheduler import SchedulerManager
if pluginconfig.presistence_scheduler:
    from plugin.scheduler import Persistence_Scheduler_Manager
from plugin.flask_docs import APIDOC
from plugin.resp import MyResponse, get_param
from plugin.mytime import MyTime
from plugin.myrandom import MyRandom
from plugin.com_method import compare_objects, compare_list, compare_object, compare_object_list_by_attr

logger = MyLogger.logger

__all__ = [
    # 日志相关
    LOGFORMAT,
    get_log,  # 获取日志对象方法
    logger,  # 全局日志对象，默认日志对象，写入base.log
    # db
    DB,  # 数据库操作类，父类
    MysqlClient,  # mysql操作类
    MSsqlClient,  # sqlserver操作类
    RedisClient,  # redis操作类
    Sqlite,
    SqliteIndep,
    Influx,
    # Exception
    MyException,  # 自定异常
    # 配置
    baseconfig,  # 配置类
    projectconfig,  # 项目配置类
    apidocconfig,  # 接口文档配置类
    pluginconfig,  # 插件配置类
    # 接口文档
    APIDOC,
    # 通用接口返回格式
    MyResponse,
    get_param,
    # 时间转换
    MyTime,
    # 随机数
    MyRandom,
    # common method
    compare_objects,
    compare_list,
    compare_object,
    compare_object_list_by_attr,
    # 定时任务
    Trigger
]
__all__ += ['SchedulerManager'] if pluginconfig.scheduler else []
__all__ += ['Persistence_Scheduler_Manager'] if pluginconfig.presistence_scheduler else []